{template '../../header'}
{template '../../left'}

<div class="card">
    <div class="card-header">
        修改友链
    </div>
    <div class="card-body">
        <form method="post">
            <div class="form-group col-4">
                <label>标题</label>
                <input class="form-control form-control-sm" type="text" maxlength="50" name="title" value="{$detail['title']}">
            </div>
            <div class="form-group col-4">
                <label>链接</label>
                <input class="form-control form-control-sm" type="text" name="url" value="{$detail['url']}">
            </div>
            <div class="form-group col-4">
                <label>排序</label>
                <input type="text" name="sort" class="form-control form-control-sm" value="{$detail['sort']}">
            </div>
            <div class="form-group col-4">
                <label>是否显示</label>
                <select name="state" class="form-control form-control-sm">
                    {loop $states $key $value}
                    <option value="{$key}" {if $detail['state']==$key}selected{/if}>{$value}</option>
                    {/loop}
                </select>
            </div>
            <div class="form-group col-4">
                <label>
                    图片
                    <span class="badge badge-pill badge-info" data-toggle="tooltip" data-placement="top" title="" data-original-title="小于500K">?</span>
                </label>
                <div class="form-control-static">
                    <label id="preview" class="preview banner">
                        +<input type="file" id="file" accept="image/*" />
                        <input type="hidden" id="thumb" name="thumb" value="{$detail['thumb']}" />
                    </label>
                    <script type="text/javascript">
                        var loading;
                        $("#file").uploadImagePreview({
                            destID: "preview",
                            imgUrl: "{$detail['thumb']}",
                            server: "/admin/upload/base64?dir=cms/link",
                            change: function (image) {
                                $("#thumb").val(image);
                            },
                            startUpload: function () {
                                loading = $.loading({title: '正在上传...'});
                            },
                            finishUpload: function () {
                                loading.unloading();
                            },
                        });
                    </script>
                </div>
            </div>
            <div class="form-group col-12">
                <button type="submit" class="btn btn-success btn-sm"><i class="fa fa-save"></i> 保存</button>
            </div>
        </form>
    </div>
</div>

{template '../../footer'}   